package com.ctcemti.mdm.project.sys.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
import com.ctcemti.mdm.project.sys.entity.formdata.BaseReq;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Id;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;

/**
 * 工点信息表
 */


@ApiModel(value = "工点信息表")
@Data
public class OrgStation extends BaseReq implements IExcelModel,IExcelDataModel,Comparable<OrgStation> {
    /**
     * 主键id
     */
    @Id
    @ApiModelProperty(value = "主键id",required = true)
    private String id;
    /**
     * 名称
     */
    @ApiModelProperty(value = "工点名称")
    @Excel(name = "工点名称")
    @NotNull(message = "工点名称不能为空")
    private String name;
    /**
     * 编号
     */
    @ApiModelProperty(value = "编号")
    private String code;
    /**
     * 上级组织ID
     */
    @ApiModelProperty(value = "上级组织ID")
    private String projectId;
    /**
     * 工点类型
     */
    @ApiModelProperty(value = "工点类型")
    @Excel(name = "工点类型")
    @NotNull(message = "工点类型不能为空")
    private String type;
    /**
     * 工点坐标
     */
    @ApiModelProperty(value = "GPS坐标")
    @Excel(name = "GPS坐标")
    private String gps;
    /**
     * 工点状态
     */
    @ApiModelProperty(value = "工点状态")
    private String state;
    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @Excel(name = "排序")
    @NotNull(message = "排序不能为空")
    @Pattern(regexp = "^-?[1-9]*$",message = "排序只能为整数")
    private String sort;
    /**
     * 起点里程
     */
    @ApiModelProperty(value = "起点里程")
    @Excel(name = "起点里程")
    private String beginMileage;
    /**
     * 终点里程
     */
    @ApiModelProperty(value = "终点里程")
    @Excel(name = "终点里程")
    private String endMileage;
    /**
     * 工点概况
     */
    @ApiModelProperty(value = "工点概况")
    @Excel(name = "工点概况")
    private String profile;
    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    private String creator;
    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    private Date createDate;
    /**
     * 修改人
     */
    @ApiModelProperty(value = "修改人")
    private String modifiedBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value = "修改时间")
    private Date modifyDate;

    @Transient
    @Excel(name = "错误提示")
    @ApiModelProperty(hidden = true)//swagger忽略属性
    private String errorMsg;

    @Transient
    @ApiModelProperty(hidden = true)//swagger忽略属性
    private int rowNum;

    @Override
    public int compareTo(OrgStation orgStation) {           //重写Comparable接口的compareTo方法，
        return this.rowNum - orgStation.getRowNum();// 根据行号升序排列，降序修改相减顺序即可
    }


}